﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace Lesson1
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Student s1=new Student() { Id=1,Name="test1"};
            Student s2 = new Student() { Id = 2, Name = "test2" };
            List<Student> students = new List<Student>() { new Student { Id=3,Name="test3",
           },new Student{ Id=4,Name="test4"} };
            using(var mydb=new MyContext())
            {
                mydb.Students.AddRange(students);
                mydb.SaveChanges();
                var query = from r in mydb.Students select r;
                foreach (var item in query) {
                    Console.WriteLine($"编号：{item.Id},姓名:{item.Name}");

                }
                Console.ReadLine();
            }
        }
    }
}
